package com.hyd.hx_adr.modules.patient.controller;

import com.hyd.hx_adr.annotations.Owner;
import com.hyd.hx_adr.domain.entity.JsonResult;
import com.hyd.hx_adr.domain.info.BaseBatchInfo;
import com.hyd.hx_adr.domain.info.BaseInfo;
import com.hyd.hx_adr.modules.patient.domain.QueryPatientInfo;
import com.hyd.hx_adr.modules.patient.domain.entity.Patient;
import com.hyd.hx_adr.modules.patient.domain.vo.ImportPatientVo;
import com.hyd.hx_adr.modules.patient.domain.vo.PatientVo;
import com.hyd.hx_adr.modules.patient.service.PatientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

@RestController
@RequestMapping("/patient")
public class PatientController {

    @Autowired
    private PatientService patientService;

    @PostMapping("/getPatientList")
    private JsonResult<List<PatientVo>> getPatientList(@RequestBody QueryPatientInfo info) {
        return patientService.getPatientList(info);
    }

    @PostMapping("/importPatient")
    public JsonResult<String> importPatient(MultipartFile file) {
        return patientService.importPatient(file);
    }

    @PostMapping("/queryPatientById")
    public JsonResult<Patient> queryPatientById(@RequestBody BaseInfo info) {
        return patientService.queryPatientById(info);
    }

    @PostMapping("/deletePatient")
    public JsonResult<String> deletePatient(@RequestBody BaseBatchInfo info) {
        return patientService.deletePatient(info);
    }
}
